home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!ts1-10
- From: rmorin@inforamp.net (Randy Charles Morin)
- Newsgroups: comp.lang.c++
- Subject: Re: How can I include IOSTREAM.H only once?
- Date: Sun, 03 Mar 96 07:36:16 GMT
- Organization: MiddleWorld SoftWare
- Message-ID: <4hbi55$899@sam.inforamp.net>
- References: <4gre90$oei@service.polymtl.ca>
- NNTP-Posting-Host: ts1-10.tor.inforamp.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <4gre90$oei@service.polymtl.ca>,
- bluefox@info.polymtl.ca (Michael Gaudette) wrote:
- >I am presently engaged in what is usually called "the learning process",
- >and I've been programming simple programs with classes. Because of this,
- >I have had to #include <iostream.h> in most of my "class.cpp" files AND
- >in my main program. This (added to conio.h and all the other standard
- >libraries) usually result in a simple program being 20000 lines long.
- >Is there any way (using Borland v4.5) to make the compiler only link
- >those files ONCE?
-
- Tell the preprocessor to include the file only if it has not already been
- included.
-
- #ifndef __IOSTREAM_H
- #include <iostream.h>
- #endif
-
- But, this can sometimes generate unexpected errors/warnings/bugs. So make
- sure you know what you are doing when you use this technique.
-
- Agrivar
-